package Text_83;

import java.util.ArrayList;
import java.util.Collections;
import java.util.function.Function;

public class Code {

	public static void main(String[] args) {
		 //引用静态方法
        //将字符串转换为数字
        ArrayList<String> list = new ArrayList<>();
        ArrayList<Integer> list1 = new ArrayList<>();
        Collections.addAll(list,"1","2","3","4","5","6","7","8");
        System.out.println("=============");
        for (String a : list){
            int num = Integer.parseInt(a);
            list1.add(num);
        }
        System.out.println(list1);
        System.out.println("=============");
        list.stream().map(new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                int num = Integer.parseInt(s);
                return num;
            }
        }).forEach(s-> System.out.print(s+" "));
        System.out.println("\n=============");
        list.stream().map(Integer::parseInt).forEach(s-> System.out.print(s+" "));

	}

}
